package cn.ly.net.tcp;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;
import java.net.UnknownHostException;

public class KeyClient {
	
	public static void main(String[] args) throws UnknownHostException, IOException, InterruptedException {
		Socket s = new Socket("192.168.0.103",22222);
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));
		String line = null;
		while( (line = br.readLine()) != null){
			bw.write(line);
			bw.newLine();
			bw.flush();
			if(line.indexOf("886") >= 0){
				break;
			}
		}
		
		bw.close();
		
		br = new BufferedReader(new InputStreamReader(s.getInputStream()));
		char[] c = new char[1024];
		br.read(c);
		System.out.println(String.valueOf(c));
		br.close();
		
		
		s.close();

		//Thread.sleep(1000*60*60);
		
		
	}

}
